<template>
  <div class="app-container home">
    <el-row :gutter="20">
      <el-col :xs="24" :sm="24" :md="12" :lg="8">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>查询面单</span>
          </div>
          <div class="body">
            <el-input
              v-model="orderSn"
              placeholder="请输入订单编号"
              style="width: 270px;"
              clearable
            />
            <el-button @click="jumpToPrint">查询</el-button>
          </div>
        </el-card>
      </el-col>
      <el-col :xs="24" :sm="24" :md="12" :lg="8">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>每天送仓之前点击</span>
          </div>
          <div class="body">
            <el-button>马上送仓(暂时未完成)</el-button>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "Index",
  data() {
    return {
      orderSn: "",
    };
  },
  methods: {
    goTarget(href) {
      window.open(href, "_blank");
    },

    jumpToPrint() {
      if (this.orderSn.trim() != "") {
        this.goTarget(
          "https://shopee-document.oss-cn-shenzhen.aliyuncs.com/order-pdf/" +
          this.orderSn.substring(0, 2) + "/" + this.orderSn.substring(2, 4) + "/" + this.orderSn + ".pdf"
        );
      }
    },
  },
};
</script>

<style scoped lang="scss">
.el-input {
  margin-right: 10px;
}
</style>

